package run.iget.tools.web.exception;

import lombok.Getter;
import run.iget.tools.web.code.BaseResponseCode;

/**
 * Copyright (C), 2021，行动改变认知[iget.run]
 * 代码千万行，注释第一行
 * ---------------类描述--------------------
 * 业务异常对象
 * ---------------类描述--------------------
 * @author 大周|450513554@qq.com
 * @since 2020/12/12 20:5625
 */
@Getter
public class BizException extends RuntimeException {

    /**
     * 返回码状态对象
     */
    private BaseResponseCode.ResponseStatus responseStatus;

    /**
     * 带参构造方法
     * @param responseStatus -- 要抛出的返回状态
     */
    public BizException(BaseResponseCode.ResponseStatus responseStatus){
        super(responseStatus.getMsg());
        this.responseStatus = responseStatus;
    }

    /**
     * 带参构造方法
     * @param msg -- 要抛出的消息
     */
    public BizException(String msg){
        super(msg);
        this.responseStatus = new BaseResponseCode.ResponseStatus(BaseResponseCode.ERROR_500.getCode(), msg);
    }

}
